<template>
	<view>
		<view class="main" style="margin-top: 4vw;background: #fff; border-radius: 2vw;display: block;float: left;" v-if="!cuo">
				<view class="center_qb t23" style="margin-top: 8vw;">确认信息</view>
				<view class="center_qb t1">请确认前面所填所有信息均真实有效，以防延误您的申请时间。</view>
			<!-- <view class="center_qb t13" v-if="strs!=''">错误提示：{{strs}}</view> -->
				<view class="tuic t2" @click="shengqing()">确定</view>
		</view>
		<view class="main" style="margin-top: 4vw;background: #fff; border-radius: 2vw;display: block;float: left;" v-if="cuo">
				<view class="center_qb t23" style="margin-top: 8vw;">报错信息</view>
				<view class="center_qb">{{cuo}}</view>
				<!-- <view class="center_qb t1">{{cuo.ali}}</view>
				<view class="center_qb t1">{{cuo.wechat}}</view> -->
				<view class="tuic t2" @click="fanhui()" style="margin-bottom: 2vw;">返回重新填写</view>
				<view class="dp_but1 t12" @click="indexs()">返回首页</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				mainid: '',
				cuo:'',
			}
		},
		onLoad() {
			var _this = this;
			uni.getStorage({
				key: 'user',
				success: function(res) {
					_this.mainid = res.data.id;
				}
			});
		},
		methods: {
			indexs(){
				uni.switchTab({
					url: '../index/index'
				});
			},
			fanhui(){
				uni.navigateBack({
					delta:3
				})
			},
			shengqing() {
				var _this = this;
				uni.showLoading();
				var data = {
					id: _this.mainid, //	用户ID（mainId）		true	string
				};
				data = JSON.stringify(data);
				uni.request({
					header: {
						'Content-Type': 'application/json', //自定义请求头信息
					},
					url: getApp().globalData.url + 'mch/applyMch/'+_this.mainid, //仅为示例，并非真实接口地址。
					method: 'post',
					data: data,
					success: (res) => {
						uni.hideLoading();
						console.log(res);
						if (res.data.status == '200') {
							uni.showToast({
								title: '支付申请提交成功,请到首页的申请进度中查询进度',
								icon: 'none',
								duration: 2000
							});
							setTimeout(function() {
								uni.switchTab({
									url: '../index/index'
								});
							}, 2000)

						} else if(res.data.status == '501'){
							let str = "";
							for (var a in res.data.data) str += res.data.data[a] + ";\n";
							if (_this.cuo == '') {
								_this.cuo = str;
							} else {
								_this.cuo = _this.strs + ';' + str;
							}
							uni.setNavigationBarTitle({
								title: '错误提示'
							})
							// _this.cuo=res.data.data;
							// uni.showToast({
							// 	title: str,
							// 	icon: 'none',
							// 	duration: 3000
							// });
						} else {
								let str = "";
								for (var a in res.data.data) str += res.data.data[a] + ";\n";
								if (_this.cuo == '') {
									_this.cuo = str;
								} else {
									_this.cuo = _this.strs + ';' + str;
								}
								uni.setNavigationBarTitle({
									title: '错误提示'
								})
								// _this.cuo=res.data.data;
								// uni.showToast({
								// 	title: str,
								// 	icon: 'none',
								// 	duration: 3000
								// });
						}
					},
					fail: (error) => {
						console.log(error)
						let str = "";
							for (var a in res.data.data) str += res.data.data[a] + ";\n";
							if (_this.cuo == '') {
								_this.cuo = str;
							} else {
								_this.cuo = _this.strs + ';' + str;
							}
							uni.setNavigationBarTitle({
								title: '错误提示'
							})
							// _this.cuo=res.data.data;
							// uni.showToast({
							// 	title: str,
							// 	icon: 'none',
							// 	duration: 3000
							// });
					}
				});
			}
		}
	}
</script>

<style>
	.buts {
		width: 80%;
		height: 10vw;
		display: block;
		float: left;
		background: #F1C75E;
		text-align: center;
		line-height: 10vw;
		border-radius: 2vw;
		margin: 4vw 10%;
	}

	.center_qb {
		width: 100%;
		height: auto;
		line-height: 8vw;
		display: block;
		float: left;
		padding: 2vw 5vw;
	}

	.login_main_li_yzm {
		width: auto;
		height: 8vw;
		display: block;
		float: right;
		background: #fcbe16;
		padding: 0 3vw;
		line-height: 8vw;
		border-radius: 4vw;
	}

	.shuru {
		width: 100%;
		height: auto;
		display: block;
		float: left;
		border-radius: 1vw;
		overflow: hidden;
		padding: 2vw 4vw;
		background: #fff;
		margin-top: 4vw;
		box-shadow: 0px 0px 5px #eee;
	}

	.shuru_tit {
		width: 30%;
		height: 10vw;
		line-height: 10vw;
		display: block;
		float: left;
	}

	.shuru_text {
		width: 60%;
		height: 10vw;
		line-height: 10vw;
		display: block;
		float: right;
		text-align: right;
	}

	select.shuru_text {
		border: none;
	}



	.baodan_zhu {
		width: 90%;
		height: auto;
		display: block;
		float: left;
		margin: 2vw 5%;
		background: #fff;
		border-radius: 2vw;
		padding: 4vw;
		box-shadow: 0px 0px 1vw #ccc;
		margin-top: 3vw;
	}

	.baodan_tit {
		width: 100%;
		height: 8vw;
		line-height: 8vw;
		display: block;
		float: left;
		text-align: center;
	}

	.baodan_into {
		width: 100%;
		height: auto;
		display: block;
		float: left;
		line-height: 7vw;
		display: block;
		float: left;
		min-height: 40vw;
		background: url(../../static/img/jiaa.png) no-repeat center;
	}

	.baodan_into_image {
		width: 90%;
		height: auto;
		display: block;
		float: left;
		margin: 0 5%;
	}

	.shuru_text1 {
		width: 100%;
		height: 10vw;
		line-height: 10vw;
		display: block;
		float: left;
	}

	.shuru_text2 {
		background: url(../../static/img/turn.png) no-repeat right center;
		background-size: 3vw;
		line-height: 10vw;
		text-align: right;
		padding-right: 4vw;
	}.dp_but1 {
		width: 100%;
		height: 7vw;
		line-height: 7vw;
		display: block;
		float: left;
		text-align: center;
		margin-bottom: 4vw;
		/* padding: 0 5vw; */
		text-decoration: underline;
		/* border-radius: 2vw; */
		/* border: 1px solid #F1C75E; */
	}
</style>
